﻿<%@ Page Title="" Language="C#" MasterPageFile="~/cms/cms.master" AutoEventWireup="true" CodeFile="ListUserInfo.aspx.cs" Inherits="cms_ListUserInfo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
    
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain" Runat="Server">
    <h1 class="top-heading">List User Info</h1>
    <asp:GridView ID="GVUserInfo" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ID" DataSourceID="SqlGetAllUserInfo" Width="100%" 
        AllowPaging="True" AllowSorting="True" PageSize="30" 
        onrowcommand="GVUserInfo_RowCommand">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
                ReadOnly="True" SortExpression="ID" >
            <HeaderStyle HorizontalAlign="Center" />
            <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Username" HeaderText="Username" ReadOnly="True"
                SortExpression="Username" />
            <asp:BoundField HeaderText="Password" SortExpression="Password"/>
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:CheckBoxField DataField="IsEnabled" HeaderText="IsEnabled" 
                SortExpression="IsEnabled" >
            <HeaderStyle HorizontalAlign="Center" />
            <ItemStyle HorizontalAlign="Center" />
            </asp:CheckBoxField>
            <asp:CheckBoxField DataField="IsAdmin" HeaderText="IsAdmin" 
                SortExpression="IsAdmin" >
            <HeaderStyle HorizontalAlign="Center" />
            <ItemStyle HorizontalAlign="Center" />
            </asp:CheckBoxField>
            <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
            <asp:BoundField DataField="DateCreated" HeaderText="DateCreated" ReadOnly="True"
                SortExpression="DateCreated" />
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Edit" CommandArgument='<%# Eval("Id") %>' 
                        Visible='<%# Convert.ToInt32(Eval("Id"))==1?false:true %>'></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" OnClientClick="return confirm('Do you want to delete this ?');"
                        CommandName="Delete" Text="Delete" CommandArgument='<%# Eval("Id") %>' 
                        Visible='<%# Convert.ToInt32(Eval("Id"))==1?false:true %>'></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateField>
        </Columns>
        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" 
            Font-Underline="False" Wrap="True" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlGetAllUserInfo" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="GetAllUserInfo" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="Id" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:HyperLink ID="hplAddNewUser" runat="server" 
        NavigateUrl="~/cms/AddNewUserInfo.aspx">Add New User</asp:HyperLink>
</asp:Content>

